function sum(n1, n2, n3) {
	var r = n1 + n2 + n3;
	return r;
}

//多余的实参不参与运算
var r = sum(5, 6, 7, 9, 0,10);
console.log("r=" + r);
  

  //实参个数不定的情况下，
  //可以通过arguments这个类数组来获取实参
function sumOfManyNum(){
	//arguments是函数调用时存放实参的类数组
	//console.log(arguments);
	var sum = 0;
	for (var i = 0; i < arguments.length; i++){
		sum += arguments[i];
	}
	return sum;

}
sumOfManyNum(5, 6, 7, 8);
console.log("r=" + r);